<template>
	<view>
		<view class="title">欢迎注册cuit点评</view>
		<view class="tip">请完善以下信息</view>
		 <input v-model="name" class="text" placeholder="请输入昵称" /> 
		 <input v-model="message" class="text" placeholder="请输入邮箱"/> 
		 <input v-model="pwd" type="password" class="text" placeholder="请输入密码"/> 
		 <input v-model="aspwd" class="text" type="password" placeholder="请确认密码"/> 
		 <input v-model="coder" class="text" placeholder="请输入验证码"/> 
		 <button class="code" @click="email" style="background-color: #00FF7F;">获取验证码</button>
		 <button class="code" @click="user" style="background-color: #fafa00;">注册</button>
		 <view class="tips">Tips:验证码有可能在垃圾邮件.......</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				name:"",
				message:"",
				pwd:"",
				aspwd:"",
				coder:""
				
			}
		},
		methods: {
			email(){
				uni.request({
					url:"https://gljh.utools.club/mail/MailServer",
					data:{
						account:this.message
					},
				    success: (res) => {
				        console.log(res.data);
				        this.text = 'request success';
				    }
				});
			},
			user(){
				uni.request({
					url:"https://gljh.utools.club/user/register",
					data:{
						nickName:this.name,
						mailaddress:this.message,
						password:this.pwd,
						checkCode:this.coder
					},
					method:"POST",
				    success: (res) => {
				        console.log(res.data);
				        this.text = 'request success';
						uni.redirectTo({
							url:'../login/login'
						})
				    }
				});
			},
			login(){
				uni.redirectTo({
					url:"../login/login"
				})
			}
		}
	}
</script>

<style>
.title{
	text-align: center;
	font-size: 60upx;
	margin-top: 100upx;	
}
.tip{
	margin-left: 200upx;
	margin-top: 50upx;
}
.text{
	width: 40%;
	margin-top: 50upx;
	margin-left: 200upx;
	border-bottom: #555555 solid 2upx;
}
.code{
	width: 40%;
	margin-top: 20upx;
	margin-left: 200upx;
}
.tips{
	color: #4b4b4b;
	font-size: 10upx;
	margin-left: 200upx;
	margin-top: 100upx;
}
</style>
